package com.wn.sms.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author yellow Docter
 * @date 2023 -07-21
 * @desc  短信的自动装配
 */
@Configuration
@EnableConfigurationProperties({SmsProperties.class})  //引入 sms的配置 添加到ioc容器中
public class SmsAutoConfiguration {

    //创建对象 添加到ioc容器中
    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties) {
        SmsTemplate smsTemplate = new SmsTemplate(smsProperties);
        return smsTemplate;
    }
}
